<?php
include_once '../inc/config.inc.php';
include_once '../inc/mysql.inc.php';
include_once 'inc/tool.inc.php';
include_once '../inc/page.inc.php';
$link=connect();
include_once 'inc/is_manage_login.inc.php';//验证管理员是否登录
$template['title']='侧边栏管理页';
$template['css']=array('style/public.css');
?>
<?php include 'inc/header.inc.php'?>
<div id="main">
	<?php
		$query="select content from leftInfo";
		$result=execute($link,$query);
		$rows=mysqli_affected_rows($link);

		$page=page($rows,5,5);
		$query="select id,title,time from leftInfo order by id asc {$page['limit']}";
		$result=execute($link, $query);
		
		echo "<div class='title'>侧边栏管理页</div>";
		echo "<table class='tab' cellspacing='0' cellpadding='15' align='center'>";
		echo "<tr align='center'><th>序号</th><th>标题</th><th>发布时间</th><th>操作</th></tr>";

		while($data=mysqli_fetch_assoc($result)){
			$url=urlencode("leftInfo_delete.php?id={$data['id']}");
			$return_url=urlencode($_SERVER['REQUEST_URI']);
			$message="你真的要删除  {$data['title']} 吗？";
			$delete_url="confirm.php?url={$url}&return_url={$return_url}&message={$message}";
			echo "<tr align='center'><td>".$data['id']."</td><td>".$data['title']."</td><td>".$data['time']."</td><td><a href='leftInfo_update.php?id={$data['id']}'>[编辑]</a> &nbsp; <a href='leftInfo_add.php?id={$data['id']}'>[添加]</a> &nbsp; <a href='$delete_url'>[删除]</a></td></tr>";
		}
			echo "<tr align='center'><td colspan='4'>".$page['html']."</td></tr>";

		echo "</table>";

	?>
</div>
<?php include 'inc/footer.inc.php'; close($link);?>